#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f;

void solve()
{
	int q;
	cin >> q;
	vector<pair<int, int>> a;
	int left = 0;
	while (q--)
	{
		int op;
		cin >> op;
		if (op == 1)
		{
			int c, x;
			cin >> c >> x;
			a.push_back({ x,c });
		}
		else
		{
			int k;
			cin >> k;
			int ans = 0;
			for (; left < a.size(); left++)
			{
				if (k >= a[left].second) k -= a[left].second, ans += a[left].first * a[left].second;
				else
				{
					ans += k * a[left].first;
					a[left].second -= k;
					break;
				}
			}
			cout << ans << endl;
		}
	}
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int _ = 1;
	// cin >> _;
	while (_--)
	{
		solve();
	}
	return 0;
}